﻿<%@ Page Title="确认订购" Language="C#" MasterPageFile="~/member/mMenber.master" AutoEventWireup="true" CodeBehind="NewOrder.aspx.cs" Inherits="map.member.order.NewOrder" %>
<%@ Register assembly="AjaxControlToolkit, Version=3.0.20820.16598, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head2" runat="server">  
     <style type ="text/css">
        .mainContentDiv
        {
            width:90%;
        }
        .hd
        {
            line-height:20px;  
            height:20px; 
            position:relative;
            display:block; 
            background:url(/img/box_bg.gif) no-repeat 0px 0px;
        }
        .hd h3
        {
            padding-right:8px;
            line-height:20px;  
            padding-left:8px; 
            background:url(/img/box_bg.gif) no-repeat right top;
        }
        .hd h3 span
        {
            line-height:20px;  
            vertical-align:middle; 
            height:20px; 
            font-style:normal; 
            display:block; 
            background:url(/img/box_bg.gif) repeat-x  left bottom; 
        }
        .hb
        {
            padding-left:10px;
            border:solid 1px lightBlue
        }
        .hb ul li
        {
            list-style-type:none;
        }
        .td0
        {
            text-align:left;
            width:50%;
        }
        .td1
        {
            text-align:left;
            width:50%;
        }
        .box
        {
            margin-top:10px;
        }
         .td_e_0
        {
            width:20%;
            text-align:right ;
            line-height:25px;
            vertical-align:top;
        }
        .td_e_1
        {
            width:80%;
            padding-left:5px;
            text-align:left ;         
            line-height:25px; 
            vertical-align:top;
        }
        .td_e_1 table td
        {                                  
            line-height:20px;
        }
        .totalPriceLabel
        {
            color:Red;
            font-size:xx-large ;
        }
        .BuyItemBuuton
        {
            background:url(/img/buyitem.gif) no-repeat;
            border:none;
            width:139px;
            height:27px;                  
            cursor:pointer;
            margin-bottom:5px;
        }
        .BuyExplainSpan
        {                                                    
            border:solid 1px #FFCC7F;
            background-color: #FFFFE5;
            font-style:normal;
        }
        .BuyExplainSpan em
        {      
            background:url(/img/icon.idea_16x16.gif) no-repeat;
            padding-left:20px;
            font-style:normal;
        }
        .TextWaterStyle
        {
            color:Gray;
        }
        .LabelStyle
        {
            color:Blue;
        }
        .validateErrorMsg
        {
            background:url(/img/errorMsg.ico) no-repeat ;
            padding-left:20px;
            border:solid 1px red;
            font-size:smaller;
            padding:2px 2px 2px 20px;
            color:Red;
        }
     </style>
     <link href="../../outstyle.css" rel="stylesheet" type="text/css" />
     <script src="../../js/dropdowncontent.js" type="text/javascript"></script>
      
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
      <div class="mainContentDiv">
           <div  class="box">
               <div class="hd">
                   <h3 >
                       <span >宝贝信息</span>
                   </h3>
               </div>
               <div class="hb">
                    <table style=" width:100%;">
                        <tr>
                            <td style =" width:60px; height:60px;">
                                <asp:Image  Width="80px" Height="80px" ID="ItemImage" runat="server" /> 
                            </td>
                            <td>
                                <table width="100%" >
                                    <tr>
                                        <td  style=" width:100%"  colspan="2">
                                            <label>宝贝名称：</label>
                                            <asp:HyperLink ID="ItemNameHyperLink" runat="server">name</asp:HyperLink>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class ="td0">
                                            <label>宝贝单价：</label>
                                            <asp:Label ID="ItemPriceLabel" CssClass="LabelStyle" runat="server" Text="0.00"></asp:Label><span style="color:Blue">元</span>
                                        </td>
                                        <td class ="td1">
                                            <label>所在地：</label>
                                            <asp:Label ID="SellerAddLabel" CssClass="LabelStyle"  runat="server" Text="北京"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class ="td1">
                                            <label>卖    家：</label>
                                            <asp:Label ID="SellerNickLabel" CssClass="LabelStyle"  runat="server" Text=""></asp:Label>
                                            <asp:Literal ID="SellerChatLinkLiteral" runat="server"></asp:Literal>
                                            <input  type="hidden"  runat="server" id="seller_useridHidden" value=""/>
                                            <input  type="hidden"  runat="server" id="itemiidHidden" value=""/>
                                        </td>
                                        
                                        <td class ="td0">
                                            &nbsp;
                                            <%--<label>支付方式：</label>
                                            <asp:Label ID="PayTypeLabel" CssClass="LabelStyle"  runat="server" Text="首信易支付"></asp:Label>--%>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
               </div>
           </div>
           
           <div class="box">
               <div class="hd">
                   <h3 >
                       <span >确认收货地址</span>
                   </h3>
               </div>
               <div class="hb"> 
                   <div style=" margin:5px 5px 5px 5px;">
                       <asp:RadioButtonList AutoPostBack="true" ID="PostAddressRadioButtonList"  runat="server" 
                           CellSpacing ="3" 
                           onselectedindexchanged="PostAddressRadioButtonList_SelectedIndexChanged">
                            <asp:ListItem  Selected="True" Text="使用其他地址" Value=""></asp:ListItem>
                       </asp:RadioButtonList>
                       <div id="OtherAddressDiv" runat="server" >
                            <table  cellpadding="0" cellspacing="0" width="100%" class ="editAddressTable">
                                <tr>
                                    <td class="td_e_0">
                                       收货人姓名：
                                    </td>
                                    <td class="td_e_1">
                                        <asp:TextBox ID="ReceiveNameTextBox" runat="server"></asp:TextBox> 
                                        <span style="color:red">*</span>
                                        
                                    </td> 
                                </tr>
                                <tr>
                                    <td class="td_e_0">
                                       所在地区：
                                    </td>
                                    <td class="td_e_1">
                                        省：
                                        <asp:DropDownList Width="100px" AppendDataBoundItems="true" DataTextField="省编码" DataValueField ="省编码" ID="ProvinceDropDownList" runat="server" 
                                            AutoPostBack="True" 
                                            onselectedindexchanged="ProvinceDropDownList_SelectedIndexChanged">
                                        </asp:DropDownList>
                                        市：
                                        <asp:DropDownList Width="100px" AppendDataBoundItems="true"  DataTextField="县编码" DataValueField ="县编码" ID="CityDropDownList" runat="server" 
                                            AutoPostBack="True" 
                                            onselectedindexchanged="CityDropDownList_SelectedIndexChanged">
                                        </asp:DropDownList>
                                        区：
                                        <asp:DropDownList Width="100px" AppendDataBoundItems="true"  DataTextField="区编码" DataValueField ="区编码" ID="DisctictDropDownList" runat="server" 
                                            AutoPostBack="True" 
                                            onselectedindexchanged="DisctictDropDownList_SelectedIndexChanged">
                                        </asp:DropDownList>
                                        区域：
                                        <asp:DropDownList Width="100px" AppendDataBoundItems="true"  DataTextField="区域编码" DataValueField ="区域编码" ID="AreaDropDownList" runat="server">
                                        </asp:DropDownList>
                                        <span style="color:red">*</span>
                                        <a href="#">如果没有找到，可以手工添加</a>
                                    </td> 
                                </tr>
                                <tr>
                                    <td class="td_e_0">
                                       街道地址：
                                    </td>
                                    <td class="td_e_1">
                                        <asp:TextBox ID="DetailAddressTextBox" TextMode="MultiLine" Width="400px" Height="50px" runat="server"></asp:TextBox> 
                                        <span style="color:red">*</span>		  
                                        <span style=" color:Gray ; font-size:smaller;">(不需要重复填写省/市/区)</span>
                                        <%--<asp:CustomValidator ID="CustomValidator1"  CssClass="validateErrorMsg" runat="server"  ControlToValidate="DetailAddressTextBox"  
                                            ClientValidationFunction="valComments_ClientValidate"  ValidateEmptyText="true"
                                            ErrorMessage="街道地址不能少于5个字"  ></asp:CustomValidator>--%>
                                    </td>                                                                                                    
                                </tr>
                                <tr>
                                    <td class="td_e_0">
                                       邮政编码：
                                    </td>
                                    <td class="td_e_1">
                                        <asp:TextBox ID="PostCodeTextBox" runat="server"></asp:TextBox>
                                        <span style="color:red">*</span>		  
                                        <span style=" color:Gray ; font-size:smaller;">(大陆用户必填)</span>		
                                    </td> 
                                </tr> 
                                <tr>
                                    <td class="td_e_0">
                                       电话号码：
                                    </td>
                                    <td class="td_e_1">
                                        <asp:TextBox ID="PhoneTextBox" Width="100px" MaxLength="12" runat="server"></asp:TextBox>-
                                        <asp:TextBox ID="PhoneLocalTextBox"  Width="50px" runat="server"></asp:TextBox> 
                                        <span style="color:blue">*</span>
                                        <span style=" color:Gray; font-size:smaller; ">电话号码(区号-号码)-分机</span>		            
                                    </td> 
                                </tr>
                                <tr>
                                    <td class="td_e_0">
                                       手机：
                                    </td>
                                    <td class="td_e_1">
                                        <asp:TextBox ID="PhoneMobileTextBox" runat="server"></asp:TextBox>
                                        <span style="color:blue">*</span>  
                                        <span style=" color:Gray; font-size:smaller; ">电话号码和电话号码必须填一个</span>	
                                    </td> 
                                </tr>
                            </table>
                       </div>
                   </div>
               </div>
           </div>
           
           <div class="box">
               <div class="hd">                   
                   <h3 >                       
                       <span >确认购买信息</span>
                   </h3>
               </div>
               <div class="hb"> 
                    <table cellpadding="0" cellspacing="0" style=" width:100%; margin:5px 5px 5px 5px;" >
                        <tr>
                            <td class="td_e_0">
                               购买数量：
                            </td>
                            <td class="td_e_1">
                                <span style="color:red">*</span>
                                <asp:TextBox ID="ItemCountTextBox"  runat="server" 
                                    >1</asp:TextBox>                                                                   
                            </td> 
                        </tr>
                        <tr>
                            <td class="td_e_0">
                               运送方式：
                            </td>
                            <td class="td_e_1">
                                <table cellpadding="0"  cellspacing="0">
                                    <tr>
                                        <td style=" vertical-align:top; width:10px"><span style="color:red">*</span> </td>
                                        <td style=" background-color:#ECECEC;  width:400px; padding-left:20px; padding:5px 5px 5px 20px">
                                            <asp:RadioButtonList CellSpacing="0" CellPadding="0" 
                                                ID="PostTypeRadioButtonList" runat="server" AutoPostBack="True" 
                                                onselectedindexchanged="PostTypeRadioButtonList_SelectedIndexChanged">
                                                <asp:ListItem Value="货到付款" Selected="True">货到付款</asp:ListItem> 
                                                <asp:ListItem Value="快递" >快递</asp:ListItem>
                                                <asp:ListItem Value="平邮" >平邮</asp:ListItem>
                                                <asp:ListItem Value="EMS" >EMS</asp:ListItem>
                                            </asp:RadioButtonList> 
                                        </td>
                                    </tr>
                                </table>                                              
                            </td> 
                        </tr>
                        <tr>
                            <td class="td_e_0">
                                给卖家留言：
                            </td>
                            <td class="td_e_1">
                                <asp:TextBox ID="LiuYanTextBox" TextMode="MultiLine" Width="500px" Height="50px" runat="server"></asp:TextBox>                                                                   
                                <cc1:TextBoxWatermarkExtender ID="LiuYanTextBox_TextBoxWatermarkExtender"   
                                    runat="server" Enabled="True" TargetControlID="LiuYanTextBox" 
                                    WatermarkText="选填，可以告诉卖家您对商品的特殊要求，如颜色，大小等等" WatermarkCssClass="TextWaterStyle">
                                </cc1:TextBoxWatermarkExtender>
                            </td> 
                        </tr>
                    </table>
               </div>
           </div>
           
           <div class="box">
               <div class="hd">
                   <h3 >
                       <span >确认提交订单</span>
                   </h3>
               </div>
               <div class="hb"> 
                    <table width="100%">
                        <tr>
                            <td class="td_e_0">
                                实际付费：
                            </td>
                            <td class="td_e_1">
                                <asp:Label ID="TotalPriceLabel" CssClass="totalPriceLabel" runat="server" ></asp:Label> 元                                                                 
                            </td> 
                        </tr>
                        <tr>
                            <td class="td_e_0"  style=" vertical-align:middle;">
                                校验码：
                            </td>
                            <td class="td_e_1"  style=" vertical-align:middle;">
                                <table>
                                    <tr>
                                        <td>
                                            <input  type="text" id="CheckupCodeInput" style=" width:80px" value="" />
                                        </td>
                                        <td>
                                            <img src ="/controls/RandomCheckupCoding.aspx?count=4&key=test" id="checkupImg"/>
                                        </td>
                                        <td>
                                            <a href ="#1" onclick="refreshCheckupImg();" style=" font-size:smaller;">看不清楚，换一张</a>
                                        </td>
                                    </tr>
                                </table>
                                
                                                                                               
                            </td> 
                        </tr>                        
                    </table>
               </div>
               
               <div class="box" style=" text-align:center;">
                     <asp:Button ID="ConfirmBuyButton" runat="server" Text=""  
                         OnClientClick="return ConfirmButtonClientClick();" CssClass ="BuyItemBuuton" 
                         onclick="ConfirmBuyButton_Click"/><br />
                     <span class="BuyExplainSpan"><em>若有价格变动（包括运费），您可以在点击该按钮后，联系卖家修改</em></span>                      
               </div>
           </div>
      </div>   
      <script src="/js/PageValidateUtil.js" type="text/javascript"></script>
      <script type="text/javascript">
          var contentIdPrefix ="ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder3_";
          //刷新验证码
          function refreshCheckupImg() {
              var checkupImg = document.getElementById("checkupImg");
              checkupImg.src = "/controls/RandomCheckupCoding.aspx?count=4&key=test&dd=" + Date().toString();
          }
          //验证码
          function validateCheckUp() {
              var checkupInput = document.getElementById("CheckupCodeInput");
              var result = AjaxFunction.GetSessionValue("test_checkcode");
              if (result.value != null && result.value != "") {
                  return (result.value.toLowerCase() == checkupInput.value.toLowerCase());
              }
              return false;
          } //"ItemCountTextBox"
          PageValidateUtil.TextRegexValidate(contentIdPrefix + "ItemCountTextBox", /^[1-9](|[0-9]+)$/, "购买数量应该为正整数", "validateErrorMsg", true, 2);
          PageValidateUtil.CustomerValidate("CheckupCodeInput", validateCheckUp, "验证码不正确！", "validateErrorMsg", 2);

          function ConfirmButtonClientClick() {
              var PostAddressRadioButtonLists = document.getElementsByName("ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder3$PostAddressRadioButtonList");
              var currentAddr = "";
              for (var i = 0; i < PostAddressRadioButtonLists.length; i++) {
                  if (PostAddressRadioButtonLists[i].checked == true) {
                      currentAddr = PostAddressRadioButtonLists[i].value;
                      break;
                  }
              }
              var errorCount = PageValidateUtil.initImidValidates(["TextRegexValidate", "CustomerValidate"],[
                    [contentIdPrefix + "ItemCountTextBox", /^[1-9](|[0-9]+)$/, "购买数量应该为正整数", "validateErrorMsg", true, 1], 
                    ["CheckupCodeInput", validateCheckUp, "验证码不正确！", "validateErrorMsg", 1]]);
              if (currentAddr == "") {
                    errorCount += PageValidateUtil.initImidValidates(["TextRegexValidate", "TextRegexValidate", "TextRegexValidate", "SelectValidate", "GroupValidate"], [
                             [contentIdPrefix + "ReceiveNameTextBox", /^$|^(\s)+$/, "收货人姓名不能为空", "validateErrorMsg", false, 2],
                             [contentIdPrefix + "PostCodeTextBox", /^[1-9]([0-9]{5})$/, "邮政编码为空或者格式不正确", "validateErrorMsg", true, 2],
                             [contentIdPrefix + "DetailAddressTextBox", /^$|^(\s)+$|^.{0,4}$/, "邮政编码为空或者小于5个字符", "validateErrorMsg", false, 2],
                             [contentIdPrefix + "AreaDropDownList", "", "地区不能为空", "validateErrorMsg"],
                             [[{ id: contentIdPrefix + 'PhoneMobileTextBox', errorMsg: '手机号码和电话号码必填一个', className: 'validateErrorMsg', type: 'regex', refFunc: /^1[3|5|8]([0-9]{9})$/, otherArg: true },
                              { id: contentIdPrefix + 'PhoneTextBox', errorMsg: '手机号码和电话号码必填一个', className: 'validateErrorMsg', type: 'regex', refFunc: /^0[1-9]([0-9]{1,2})-[1-9]([0-9]{6,7})$/, otherArg: true}]]
                             ]);
              }
              return (errorCount <= 0);
          }
    </script> 
</asp:Content>
